<template>
  <div>
    <van-field v-model="course.name" label="名称" />
    <van-field v-model="course.description" label="描述" />
    <van-field v-model="course.tname" label="讲师" />
    <van-image :src='course.pic' width=100 height=100 />
    <video :src='"http://localhost:5000/static/"+i' controls="controls" v-for='i in videos' width=300 height=200></video>
    <br>
    <van-button @click='update'>修改</van-button>
  </div>
</template>
<script>

export default {
  data() {
    return {
      id: this.$route.query.id,
      course: {'name': ''},
      videos: []
    }
  },
  methods: {
    getcourse() {
      this.axios.get('courseM?id=' + this.id).then(res => {
        console.log(res)
        this.course = res.data.course
        //把视频列表转换成json
        this.videos = JSON.parse(res.data.course['vedios'])
      })
    },
    getcid(id){
      alert(id)
    },
    update() {

    }
  },
  mounted() {
    this.getcourse()
  },
}
</script>
<style>

</style>